import service from "../../service"


async function refreshProtos(setError, classId, setProtos, setActiveProtoId) {
	const { State, Data, Message } = await service.graphElementProtos.list({ classId });
	if (State == 0) {
		setProtos(Data);
	} else {
		setError(Message);
	}
	if (setActiveProtoId && Data && Data.length > 0) {
		setActiveProtoId(Data[0].Id);
	}
}


const protoTypes = [
	{ value: "1", label: "节点" },
	{ value: "2", label: "连线" },
	{ value: "3", label: "文本" },
	{ value: "4", label: "群组" },
	{ value: "5", label: "子网" },
];
export {refreshProtos,protoTypes}